package com.afdor.rws.event.driven.config;

import com.afdor.rws.annotation.extension.Extension;
import com.afdor.rws.annotation.extension.SPI;
import com.afdor.rws.event.driven.commons.Constants;
import lombok.Data;
import lombok.NonNull;

import java.io.Serializable;

/**
 * 事件持久化管理器相关配置<br/>
 * Extension : prototype
 *
 * @author 悭梵
 * @date Created in 2018-11-21 15:45
 */
@Data
@SPI(Constants.DEFAULT_COMPONENT_CONFIG_EXTENSION_NAME)
@Extension(value = Constants.DEFAULT_COMPONENT_CONFIG_EXTENSION_NAME, scope = Extension.Scope.PROTOTYPE, interfaceClass = EventPersistenceConfig.class)
public class EventPersistenceConfig extends BaseEventConfig implements Serializable, Cloneable {
    /**
     * 事件持久化处理间隔事件，单位毫秒，默认200
     */
    private int period = 200;
    /**
     * 事件持久化一次处理的事件量，默认50
     */
    private int batchSize = 50;

    public EventPersistenceConfig() {
    }

    public EventPersistenceConfig(@NonNull final EventConfig eventConfig) {
        setEventConfig(eventConfig);
    }
}
